Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mstranslator

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mstranslator

Microsoft Translator API module for node.js

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.7K
increased by560.49%
Maintainers
1
Weekly downloads
 
Created
Source

Microsoft Translator API module for node.js

Microsoft Translator Documentation

devDependency Status

SOAP version that supports translating longer strings

Methods

Microsoft Translator API Reference

API Docs

  • addTranslation
  • addTranslationArray (not implemented)
  • breakSentences (not working)
  • detect
  • detectArray
  • getLanguageNames
  • getLanguagesForSpeak
  • getLanguagesForTranslate
  • getTranslations
  • getTranslationsArray
  • speak
  • translate
  • translateArray
  • translateArray2

Installation

$ npm install mstranslator

An API key from portal.azure.com is needed to create a token as of April 30, 2017. See Microsoft Translator API Documentation. For details on previous authentication API and migration info

Example Usage - Auto-generated token

var MsTranslator = require('mstranslator');
// Second parameter to constructor (true) indicates that
// the token should be auto-generated.

var client = new MsTranslator({
  api_key: "your portal.azure.com api key"
}, true);

var params = {
  text: 'How\'s it going?'
  , from: 'en'
  , to: 'es'
};

// Don't worry about access token, it will be auto-generated if needed.
client.translate(params, function(err, data) {
  console.log(data);
});

Example Usage - Generate token manually

var MsTranslator = require('mstranslator');

var client = new MsTranslator({
  api_key: "your portal.azure.com api key"
}, true);

var params = {
  text: 'How\'s it going?'
  , from: 'en'
  , to: 'es'
};

// Using initialize_token manually.
client.initialize_token(function(err, keys){
  console.log(keys);
  client.translate(params, function(err, data) {
    console.log(data);
  });
});

Tests

npm test

License

Licensed under the MIT license.

FAQs

Package last updated on 21 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc